installer: Further work on booting with host kernel, modified dracut
authorColin Walters <walters@verbum.org>
Wed, 8 Feb 2012 22:34:08 +0000 (17:34 -0500)
committerColin Walters <walters@verbum.org>
Wed, 8 Feb 2012 22:34:08 +0000 (17:34 -0500)
gnomeos/yocto/gnomeos-install.sh
gnomeos/yocto/gnomeos-run.sh

index 613d9c509f2b8b599cc5e954b4eb1547b04355de..b9621f62227073758abc3caff71c1ee666fdc01e 100755 (executable)
@@ -55,12 +55,15 @@ EOF
     exit 1
 fi
 
+uname=$(uname -r)
+
 cd /ostree
 for branch in runtime devel; do
     rev=$(ostree --repo=$(pwd)/repo rev-parse ${BRANCH_PREFIX}${branch});
     if ! test -d ${BRANCH_PREFIX}${branch}-${rev}; then
         ostree --repo=repo checkout ${rev} ${BRANCH_PREFIX}${branch}-${rev}
         ostbuild chroot-run-triggers ${BRANCH_PREFIX}${branch}-${rev}
+        cp -ar /lib/modules/${uname} ${BRANCH_PREFIX}${branch}-${rev}/lib/modules/${uname}
     fi
     rm -f ${BRANCH_PREFIX}${branch}-current
     ln -s ${BRANCH_PREFIX}${branch}-${rev} ${BRANCH_PREFIX}${branch}-current
@@ -79,3 +82,24 @@ GRUB 2 not detected; you'll need to edit e.g. /boot/grub/grub.conf manually
 Kernel has been installed as /boot/bzImage-gnomeos.bin
 EOF
 fi
+
+kernel=/boot/vmlinuz-${uname}
+if ! test -f "${kernel}"; then
+    cat <<EOF
+    Kernel does not exist: ${kernel}
+EOF
+    exit 1
+fi
+initrd_name=initramfs-ostree-${uname}.img
+initrd_tmpdir=$(mktemp -d '/tmp/gnomeos-dracut.XXXXXXXXXX')
+linux-user-chroot \
+    --mount-readonly / \
+    --mount-proc /proc \
+    --mount-bind /dev /dev \
+    --mount-bind /ostree/var /var \
+    --mount-bind ${initrd_tmpdir} /tmp \
+    --mount-bind /lib/modules/${uname} /lib/modules/${uname} \
+    /ostree/${BRANCH_PREFIX}devel-current \
+    dracut -f /tmp/${initrd_name} "${uname}"
+mv "${initrd_tmpdir}/${initrd_name}" "/boot/${initrd_name}"
+rm -rf $"{initrd_tmpdir}"
index 9fede71c3b59db8945cd68a72355c578d39d131c..deb4389eac936c0aeb9a313b90081a9bd90b8e0e 100755 (executable)
@@ -97,6 +97,10 @@ gdm:*:2:
 EOF
 fi
 
+if test x${TYPE} = xcurrent; then
+    current_uname=$(uname -r)
+fi
+
 cd ostree
 ostree --repo=${OSTREE_REPO} local-clone repo ${BRANCH_PREFIX}runtime ${BRANCH_PREFIX}devel
 for branch in runtime devel; do
@@ -105,7 +109,7 @@ for branch in runtime devel; do
         ostree --repo=repo checkout ${rev} ${BRANCH_PREFIX}${branch}-${rev}.tmp
         ostbuild chroot-run-triggers ${BRANCH_PREFIX}${branch}-${rev}.tmp
         if test x$TYPE = xcurrent; then
-            cp -ar /lib/modules/`uname -r` ${BRANCH_PREFIX}${branch}-${rev}.tmp/lib/modules
+            cp -ar /lib/modules/${current_uname} ${BRANCH_PREFIX}${branch}-${rev}.tmp/lib/modules
         fi
         mv ${BRANCH_PREFIX}${branch}-${rev}{.tmp,}
     fi
@@ -136,8 +140,8 @@ if test x$TYPE = xqemu; then
 else
     if test x$TYPE = xcurrent; then
         ARGS="root=/dev/sda $ARGS"
-        KERNEL=/boot/vmlinuz-`uname -r`
-        INITRD_ARG="-initrd /boot/initramfs-`uname -r`.img"
+        KERNEL=/boot/vmlinuz-${current_uname}
+        INITRD_ARG="-initrd /boot/initramfs-ostree-${current_uname}.img"
     fi
 fi